module.exports = function ($scope, $state, $resource, $modal, toaster, $stateParams ){
    
    $scope.search = function (){
        var para = {
            'data' :  $scope.data
        }
        console.log(para)
        $resource('/api/ac/goc/counselingService/findWorkNumList', {}, {}).save(para, function(res){
            if(res.errcode === 0){
                $scope.list = res.data;
            }else{
                toaster.error({title: '', body: res.errmsg});
            }
        });
    }


    $scope.changedata = function (data){
        if(data){
            $scope.data = 'data';
        }else{
            $scope.data = undefined;
        }
        $scope.search();
    }
   
   


    init();
    //初始化列表
    function init(){
        $scope.currentPage = 1;		//当前页码
        $scope.itemsPerPage = 10;	//每页显示几条
        $scope.searchform = {};
        $scope.search();
    }

     
    //查看
    $scope.finduserlist = function(info) {
        console.log(1)
        if($scope.data == 'data'){
            info.data = $scope.data;
        }
        console.log(info)
        var modalInstance = $modal.open({
            template: require('../views/userWorkNumList.html'),
            controller: 'userWorkNumList',
            size: 'lg',
            resolve: {
                item : function () {
                    return info;
                },
                flag : function () {
                    return info == 1;
                }
            }
        });
        //关闭模态框刷新页面
        modalInstance.result.then(function() {
            info.openstate = 'false';
            init();
        });
    }

 


};